package com.yanggu.redisson.config;

import com.yanggu.redisson.domain.OrderData;
import org.redisson.api.RBucket;
import org.redisson.api.RGeo;
import org.redisson.api.RRateLimiter;
import org.redisson.api.RedissonClient;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * Redisson对象型数据结构配置类
 */
@Configuration
public class RedissonObjectConfig {

    @Bean("test-bucket")
    public RBucket<Integer> bucket(RedissonClient redissonClient) {
        return redissonClient.getBucket("test-bucket");
    }

    @Bean("test-bucket2")
    public RBucket<OrderData> bucket2(RedissonClient redissonClient) {
        return redissonClient.getBucket("test-bucket2");
    }

    @Bean("test-geo")
    public RGeo<String> geo(RedissonClient redissonClient) {
        return redissonClient.getGeo("test-geo");
    }

    @Bean("test-rate-limiter")
    public RRateLimiter rateLimiter(RedissonClient redissonClient) {
        return redissonClient.getRateLimiter("test-rate-limiter");
    }

}
